Imports System.Data.SqlClient

Partial Class EditNews
    Inherits System.Web.UI.Page

    Sub AddNew_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        ' SqlDataSource2.foo
    End Sub

    Sub SqlDataSource2_Deleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)
        GridView1.DataBind()
    End Sub

    Sub SqlDataSource2_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)
        GridView1.DataBind()
    End Sub

    Sub SqlDataSource2_Updated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)
        GridView1.DataBind()

    End Sub

    Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)

        ' this allows us to have items that are in the future show up in a different colour
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim toShow As DateTime = DateTime.Parse(e.Row.Cells(2).Text)

            If toShow > DateTime.Now Then
                e.Row.BackColor = Drawing.Color.BlanchedAlmond
            End If
        End If

    End Sub

    Sub FileUploaded(ByVal sender As Object, ByVal e As PictureUpload.FileUploadEventArgs)

        Dim boundControl As TextBox = CType(DetailsView1.FindControl("TextBox2"), TextBox)
        boundControl.Text = e.FileName

    End Sub

    Protected Sub DetailsView1_ItemDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewDeleteEventArgs) Handles DetailsView1.ItemDeleting
        For Each p As Parameter In SqlDataSource2.DeleteParameters
            Trace.Write(p.Name)
        Next
    End Sub
End Class
